<?php
require_once(dirname(__FILE__)."/../../libs/login/login.php");
require_once(dirname(__FILE__)."/../../libs/string/libstr.php");
require_once(dirname(__FILE__)."/../../admin/libs/member_class.php");
$mb=new member();
$mc=new libstr();
$lg=new login();
$lg->checklogin("admin_member");//检验是否登录
if($mc->Ismp($_GET["userno"])==""){
	$mc->msg("参数错误！");
	
}
$mbshow=$mb->getmembershow($_GET["userno"]);
$path="用户资料编辑";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理系统</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
<script src="../../plug/calendar/WdatePicker.js"></script>
  <script type="text/javascript">
  //判断是否为底层类
  function ischild(id){
  	$.ajax({ 
        type: "POST", 
        url: "../ajax/inc.php", 
        dataType: "text", 
        data: {"mbisbtn":true,"id":id}, 
 success: function(data){
 	  if(data.indexOf("have child")!=-1)
  {
  	 alert("该类别存在子类，请选择此类别的最底层子类作类别");
	  return ;
  }
 }
  	})
  	
  }
  </script>
<script type="text/javascript">
function checkedit(){
	
	var sex=$("input[type=radio][name='sex']:checked").val();
	var username=$("#username").val();
	var email=$("#email").val();
	var phone=$("#phone").val();
	var tel=$("#tel").val();
	var address=$("#address").val();
	var shengri=$("#shengri").val();
	var qq=$("#qq").val();
	var web=$("#web").val();
	var rootid=$("#rootid").val();
	var userno=$("#userno").val();
	
	$.ajax({ 
        type: "POST", 
        url: "../ajax/inc.php", 
        dataType: "text", 
        data: {"editbtn":true,"sex":sex,"username":username,"rootid":rootid,"email":email,"phone":phone,"tel":tel,"address":address,
       "shengri":shengri, "qq":qq,"web":web,"userno":userno}, 
        beforeSend: function(){ 
      
        }, 
 success: function(data){
//alert(data);
 	 if(data.indexOf("have child")!=-1)
  {
  	 alert("该类别存在子类，请选择此类别的最底层子类作类别");
	  return ;
  }
   if(data.indexOf("userno is null")!=-1){
    alert("该用户账号为空！");
	  return;
 }
 	   if(data.indexOf("update is ok")!=-1){
    alert("修改成功！");
    location.href="member_list.php";
	  return;
 }
 }
	
	})
	
}

</script>
</head>
<body style="background:#fff"> 
<div class="content">
    <div class="right">
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="100%" height="24" class="top_head">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="1%" align="right"  height="45">&nbsp;</td>
                    <td width="99%" >
                     <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="55%" style="padding-left:20px;padding-top:10px;"><img src="../images/head.gif" width="13" height="11"><b><?php echo $path;?></b><a href="member_list.php?classid=<?php echo $_GET["classid"];?>" style=" margin-left:20px; text-decoration:underline;">返回列表</a></td>
                        <td width="45%" align="right">&nbsp;</td>
                      </tr>
                    </table>
                    </td>
                  </tr>
                </table>
            </td>
          </tr>
   </table>
   
   
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="liebiao">
  <tr>
    <td width="11%" height="40" align="right" valign="middle">用户账户：</td>
    <td height="40" valign="middle"><?php echo $mbshow["userid"];?><font>（*登录账号是唯一性的,不允许更改）</font></td>
    </tr>
          <tr>
    <td width="11%" height="40" align="right" valign="middle">用户身份：</td>
    <td height="40" valign="middle">
    <select name="rootid" id="rootid" onchange="ischild(this.value)">
          <option value="">无</option>
          <?php
          $db->depth=0;
          $twhere="";
          $db->getchild("member_class",0,$db->getcataid($mbshow["rootid"]),"ID",".",$twhere);
          ?>
        </select><font></font>
        
        </td>
    </tr>
     <tr>
    <td height="40" align="right">用户性别：</td>
    <td height="40">  <div class="mingcheng">
      <input type="radio" name="sex"  value="男" <?php if($mbshow["sex"]=="男"){echo "checked";}?>/><bdo>男</bdo><input type="radio" name="sex"  value="女" <?php if($mbshow["sex"]=="女"){echo "checked";}?>/><bdo>女</bdo></td>
    </tr>
  <tr>
    <td height="40" align="right">真实姓名：</td>
    <td height="40"><input type="text" name="username" id="username"  value="<?php echo $mbshow["username"];?>"/><Font>
   </Font></td>
    </tr>
  <tr>
    <td height="40" align="right" valign="middle" style="padding:10px 0 0 0">Email：</td>
    <td height="40" valign="middle" ><input type="text" name="email" id="email" value="<?php echo $mbshow["email"];?>"/><Font>
  </Font></td>
    </tr>
  <tr>
    <td height="40" align="right" valign="middle">手机号码：</td>
    <td height="40" valign="middle"><input type="text" name="phone" id="phone" value="<?php echo $mbshow["phone"];?>"/><Font>
  </Font></td>
    </tr>
  <tr>
    <td height="40" align="right" valign="middle">固定电话：</td>
    <td height="40" valign="middle"><input type="text" name="tel" id="tel" value="<?php echo $mbshow["tel"];?>"/><Font>
  </Font></td>
    </tr>
  <tr>
    <td height="40" align="right" valign="middle">联系地址：</td>
    <td height="40" valign="middle"><input type="text" name="address" id="address" value="<?php echo $mbshow["address"];?>"/><Font>
  </Font></td>
    </tr>
  <tr>
    <td height="40" align="right" valign="middle" style="padding-top:5px">出生日期：</td>
    <td height="40" valign="middle"  ><input type="text" name="shengri" id="shengri" class="hasDatepicker" onfocus="WdatePicker({el:'shengri'})" value="<?php echo $mc->gettime($mbshow["shengri"],"Y-m-d");?>"/><Font>
   </Font></td>
    </tr>
  <tr>
    <td height="40" align="right" valign="middle" >QQ：</td>
    <td height="40" valign="middle"><input type="text" name="qq" id="qq" value="<?php echo $mbshow["qq"];?>"/><Font>
  </Font></td>
    </tr>
  <tr>
    <td height="40" align="right" valign="middle">个人主页：</td>
    <td height="40" valign="middle"><input type="text" name="web" id="web" value="<?php echo $mbshow["web"];?>"/><font></font></td>
    </tr>
  <tr>
    <td height="40" align="right" valign="middle">&nbsp;</td>
    <td height="40" valign="middle"><bdo>
     <input type="hidden" name="userno" id="userno" value="<?php echo $mbshow["userno"];?>" />
      <input type="submit" name="button" id="button" value="提交保存" onclick="checkedit()"/>
    </bdo></td>
    </tr>
    </table>
    </div>
</div>
</body>
</html>